package group.igfd.manager.biz.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import group.igfd.manager.biz.entity.FreightcompanyEntity;
import group.igfd.manager.biz.service.FreightcompanyService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 物流公司表
 *
 * @author knight
 * @email sunlightcs@gmail.com
 * @date 2018-10-19 14:25:30
 */
@RestController
@RequestMapping("biz/freightcompany")
@Api(tags = {"A003/ 物流信息管理"})
public class FreightcompanyController {
    @Autowired
    private FreightcompanyService freightcompanyService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @RequiresPermissions("biz:orders:list")
    @ApiOperation(value = "列表")
    public R list(){
        //PageUtils page = freightcompanyService.queryPage(params);
        List<FreightcompanyEntity> list = freightcompanyService.list();
        return R.ok().put("list", list);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("biz:freightcompany:info")
    public R info(@PathVariable("id") Integer id){
			FreightcompanyEntity freightcompany = freightcompanyService.selectById(id);

        return R.ok().put("freightcompany", freightcompany);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("biz:freightcompany:save")
    public R save(@RequestBody FreightcompanyEntity freightcompany){
			freightcompanyService.insert(freightcompany);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("biz:freightcompany:update")
    public R update(@RequestBody FreightcompanyEntity freightcompany){
			freightcompanyService.updateById(freightcompany);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("biz:freightcompany:delete")
    public R delete(@RequestBody Integer[] ids){
			freightcompanyService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
